<?php

class IndexController extends Zend_Controller_Action
{
    public function indexAction()
    {           
        $session = Zend::registry('fSession');
        $db = Zend::registry('db');
        $acl = Zend::registry('acl');        

        $sql = "SELECT * FROM threads";
        $mySelectThreads = $db->query($sql);
        $myThreads = $mySelectThreads->fetchAll();        
        
        $myParamsAllowed = $acl->isAllowed($session->groupe, null, 'admin');
        $myConsultAllowed = $acl->isAllowed($session->groupe, null, 'consult');
        
        $menuView = Zend::registry('view');
        $menuView->myThreads = $myThreads;
        $myMenu = $menuView->render('menuView.php');

        $myMotionStatus = motion_isrunning();

        $view = Zend::registry('view');
        $view->motionStatus = $myMotionStatus;
        $view->paramsAllowed = $myParamsAllowed;
        $view->consultAllowed = $myConsultAllowed;
        $view->myMenu = $myMenu;
        echo $view->render('indexView.php');
    }
    public function noRouteAction()
    {
    	$this->_redirect('/');
    }
}

?>
